// @FileName  :encode.c
// @Time      :2024/3/21 9:01
// @Author    :YKW
//# include <bits/stdc++.h>
//using namespace std;
# include <stdio.h>
# include <stdlib.h>
# include <math.h>
# include <string.h>
# include <stdlib.h>

char crpyt[150];
int cnt[150];
typedef struct node {
    char c;
    struct node *nxt;
} node;

void solve() {
    node *head = (node *) malloc(sizeof(node));
    node *tail = head;
    char buf[150];
    gets(buf);
    for (int i = 0; i < strlen(buf); i++) {//读取密文
        if (buf[i] == 't')
            buf[i] = 't';
        if (buf[i] <= 126 && buf[i] >= 32 && cnt[buf[i]] == 0) {
            cnt[buf[i]] = 1;
            if (i == 0) {
                head->c = buf[i];
                head->nxt = head;
            } else {
                node *nd = (node *) malloc(sizeof(node));
                nd->c = buf[i];
                nd->nxt = head;
                tail->nxt = nd;
                tail = nd;
            }
        }
    }
    for (int i = 32; i <= 126; i++) {
        if (cnt[i] == 0) {
            node *nd = (node *) malloc(sizeof(node));
            nd->c = i;
            nd->nxt = head;
            tail->nxt = nd;
            tail = nd;
        }
    }
    char end = head->c;
    while (head->nxt != head) {
//        printf("%c \n", head->c);
        int num = head->c;
        int numc = num;
        tail->nxt = head->nxt;
        head = tail->nxt;
        while (--num) {
            tail = tail->nxt;
            head = head->nxt;
        }
        crpyt[numc] = head->c;
    }
    crpyt[head->c] = end;
//    for (int i = 32; i <= 126; i ++) {
//        printf("%c", crpyt[i]);
//    }
    freopen("in.txt", "r", stdin);
    freopen("in_crpyt.txt", "w", stdout);
    char cc;
    while (~(scanf("%c", &cc))) {
        if (crpyt[cc] <= 126 && crpyt[cc] >= 32)
            putchar(crpyt[cc]);
        else
            putchar(cc);
    }
}

int main() {
    setbuf(stdout, 0);
    int t = 1;
    //scanf("%d", &t);
    while (t--) solve();
    return 0;
}